 import os
... import os.path
... import arcpy
... rootdir = u"L:\\山洪灾害数据\\非涉密成果\\县级工作底图成果\\最终版本\\"
... arcpy.env.workspace = rootdir
... lst=[]
... filename="WATA.shp"
... for dirname in os.listdir(rootdir):
...     if os.path.isdir(rootdir+dirname):
...         if os.path.isfile(rootdir+dirname+"\\DLG\\WATA.shp"):
...             lst.append(dirname+"\\DLG\\WATA.shp")
... files=";".join(lst)
... arcpy.Merge_management(lst, "D:\\wata\\Output.shp")